package xin.yangda.poiplus.test.entity;

import lombok.*;
import xin.yangda.poiplus.annotation.Excel;
import xin.yangda.poiplus.annotation.ExcelField;
import xin.yangda.poiplus.test.config.SexOptions;
import xin.yangda.poiplus.test.convert.UserWriteConverter;

import java.util.Date;

/**
 * @author yangdaxin
 * @version 创建时间 2019/1/17 14:29
 */
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@ToString
@Excel(value = "用户信息")
public class UserEntity {
    @ExcelField(title = "编号")
    private int id;

    @ExcelField(title = "姓名", required = true)
    private String name;

    @ExcelField(title = "用户组", name = "userGroup.name")
    private UserGroupEntity userGroup;

    @ExcelField(title = "性别", writeConverterExp = "0=未知,1=男,2=女", readConverterExp = "未知=0,男=1,女=2", options = SexOptions.class)
    private int sex;

    @ExcelField(title = "年龄")
    private int age;

    @ExcelField(title = "出生日期", dateFormat = "yyyy-MM-dd")
    private Date birthday;

    @ExcelField(title = "籍贯", writeConverter = UserWriteConverter.class)
    private String nativePlace;

    @ExcelField(title = "现居住地", width = 50)
    private String currentAddress;
}
